package com.fulihui.information.biz.content.impl.handler;

import com.fulihui.information.dal.dataobj.InfoContentExample;
import com.fulihui.information.enums.EDataObtainType;
import com.fulihui.information.enums.ELinkType;
import org.springframework.stereotype.Component;

import java.util.Date;

/**
 * 为IOS审核设计的通道，过滤了外链
 *
 * @author Willard.Hu on 2017/1/25 0025.
 */
@Component("iosAppAuditSupportHandler")
public class IOSAppAuditSupportHandler extends MySQLFirstLimitedDateOrderlyAppListPageObtainHandler {

    @Override
    public EDataObtainType obtainType() {
        return EDataObtainType.IOS_APP_AUDIT_SUPPORT;
    }

    @Override
    protected InfoContentExample toBasicExample(String categoryCode, Date limitDate) {
        InfoContentExample example = super.toBasicExample(categoryCode, limitDate);
        // toBasicExample()方法中穿件了Criteria，所以这里假设getOredCriteria()一定有一个值存在
        // 后续修改需要关注这段逻辑，如果没有创建Criteria，则会导致NPE
        example.getOredCriteria().get(0).andLinkTypeEqualTo(ELinkType.INSIDE.getCode());
        return example;
    }
}
